package com.thomas.collection;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**   
* @Description: TODO(用一句话描述该文件做什么) 
* @author thomas_liu  
* @date 2017年12月25日 上午10:25:06 
* @version V1.0   
*/

class Snow{}
class Power extends Snow{}
class Light extends Power{}
class Heavy extends Power{}
class Crusty extends Snow{}
class Slush extends Snow{}

public class AsListInference {
	public static void main(String[] args) {
		List<Snow> snow1 = Arrays.asList(new Crusty(), new Slush(), new Power());
		//Compiler says: found : java.util.List<Power> required: java.util.List<Snow>
		//Collections.addAll()  doesn't get confused
		List<Snow> snow3 = new ArrayList<Snow>();
		Collections.addAll(snow3, new Light(), new Heavy());
		
		//Give a hint using explicit type argument spcification;
		List<Snow> snow4 = Arrays.<Snow>asList(new Light(), new Heavy()); 
	}
}
